#include "histogramPanel.h"
#include <QtGui>
#include <QDebug>

HistogramPanel::HistogramPanel(QWidget *_parent, Histogram *_histogram) : QWidget(_parent), histogram(_histogram){
    setAutoFillBackground(true);
}

HistogramPanel::~HistogramPanel(){
}

QSize HistogramPanel::minimumSizeHint() const{
    return QSize(258, 155);
}

QSize HistogramPanel::sizeHint() const{
    return QSize(258, 160);
}

void HistogramPanel::paintEvent(QPaintEvent */*event*/){
    QPainter painter (this);
    painter.setPen (QPen (Qt::black));
    double k;
    for(int i = 0; i < 256; i++){
        k = histogram->getNormalizedP(i);
        //olhar em histograma o maximo
        painter.drawLine(QPointF(i, 153.0), QPointF(i, 153.0 - k));

    }
}
